package com.heima.wemedia.config;

import com.heima.wemedia.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //对所有请求都生效
        registry.addInterceptor(new UserInterceptor()).addPathPatterns("/**")
                //排除登录请求
                .excludePathPatterns("/login/in");
    }
}
